package com.gy.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.Document;

import java.util.Date;
import java.util.Map;

@Data
@Document(indexName = "academic_documents")  // Elasticsearch索引名称
public class AcademicDocument {

    @Id
    private String id; // 复合ID: 表名_原始ID

    @Field(type = FieldType.Text, analyzer = "ik_max_word")  // Elasticsearch中的字段类型及分析器
    private String title;

    @Field(type = FieldType.Keyword)
    private String documentType; // 文档类型: paper, patent, publication 等

    @Field(type = FieldType.Keyword)
    private String pdfUrl;

    @Field(type = FieldType.Long)
    private Long userId;

    @Field(type = FieldType.Date)
    private Date createdAt;

    @Field(type = FieldType.Object)
    private Map<String, Object> metadata; // 存储表特有的字段
}
